import os
from fastapi import APIRouter,Path,Query,Cookie,Header,status,Form
from typing import Optional,List,Union,Any
from pydantic import BaseModel,Field,EmailStr

app04 = APIRouter()

@app04.get("/")
async def index():
    return {
        "name":os.path.basename(__file__)
    }


@app04.post("/login")
async def login(username:str = Form(...,max_length=50),password:str = Form(...,max_length=10)):
    """
     - Form(...)表示必填表单参数
     注意： pip3 install python-multipart
    """
    return {
        "username":username,
        "password":password
    }